﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _11ExtractValueOfBit
{
    class _11ExtractValueOfBit
    {
        static void Main(string[] args)
        {
            Console.Write("Enter an integer:");
            string value = Console.ReadLine();
            int i = int.Parse(value);
            Console.Write("Enter bit position:");
            string position = Console.ReadLine();
            int b = int.Parse(position);

            int moving = i >> b;
            int bitwiseCheck = moving & 1;
            bool check = bitwiseCheck == 1;
            Console.WriteLine(check ? "The bit at the given postion has a value of 1." : "The bit at the given postion has a value of 0."); 
        }
    }
}
